-- PUT NAME OF ANY FIELD IN PLACE OF "field 1" IN THIS HANDLER
-- (Or, alternately, "hard wire" this script by putting the text
-- height directly into handler "changeScroll")
global txtHt -- text height of scrolling fields
put the textHeight of card field "field 1" into txtHt
end openCard
on changeScroll scrHt
-- The first part of this handler prevents you from
-- scrolling between lines.
global txtHt
get scrHt MOD txtHt
if (it < txtHt/2) then subtract it from scrHt
else if (scrHt > 0) and (it > 0) then add (txtHt - it) to scrHt
-- This part scrolls all the fields to the same height.
-- PUT NAMES OF ALL YOUR FIELDS HERE: ADD AS MANY AS YOU WANT
set the scroll of card field "field 1" to scrHt
set the scroll of card field "field 2" to scrHt
set the scroll of card field "field 3" to scrHt
end changeScroll
-- part 2 (field)
-- low flags: 00
-- high flags: 0007
-- rect: left=204 top=241 right=315 bottom=290
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name: field 2
----- HyperTalk script -----
on mouseWithin
put the scroll of card field "field 2" into scrHt
changeScroll scrHt
end mouseWithin
-- part 3 (field)
-- low flags: 00
-- high flags: 0007
-- rect: left=289 top=241 right=315 bottom=375
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 65535
-- font id: 3
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name: field 3
-- part 1 (field)
-- low flags: 00
-- high flags: 0007
-- rect: left=119 top=241 right=315 bottom=205
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name: field 1
----- HyperTalk script -----
on mouseWithin
put the scroll of card field "field 1" into scrHt
changeScroll scrHt
end mouseWithin
-- part 21 (field)
-- low flags: 01
-- high flags: 0002
-- rect: left=358 top=241 right=315 bottom=375
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name:
-- part 33 (field)
-- low flags: 01
-- high flags: 0002
-- rect: left=153 top=80 right=131 bottom=351
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Domain
-- part 34 (field)
-- low flags: 01
-- high flags: 0002
-- rect: left=174 top=149 right=230 bottom=315
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Me
----- HyperTalk script -----
on mouseWithin
put empty into msg
set the loc of msg to the mouseLoc
Put "Stop tickling me!"
end mouseWithin
on mouseLeave
put empty into msg
hide msg
end mouseLeave
-- part 28 (field)
-- low flags: 80
-- high flags: 4007
-- rect: left=53 top=65 right=236 bottom=468
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name: Hello
-- part 31 (field)
-- low flags: 80
-- high flags: 0002
-- rect: left=451 top=65 right=236 bottom=468
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: hello scroll mask
-- part 35 (field)
-- low flags: 00
-- high flags: 4000
-- rect: left=289 top=241 right=314 bottom=359
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name: field 3 mask
-- part contents for card part 1
----- text -----
1
2
3
4
5
6
7
8
9
10
-- part contents for card part 2
----- text -----
partridge
turtle doves
red hens
gold rings
birds a laying
Jasmine 20's
Fuji disks
disk labels
A+ mouses
pear trees
-- part contents for card part 28
----- text -----
These scripts enable you to control several fields with one scroll bar. Any scroll bar can control all the others depending on which one you are moving at any given time. Just copy the script for field "field 1" into all fields you wish to make controllers.
You may wish to cover up the scroll bars you don't want people to use with opaque fields, as I have done with in field "field 3", so people don't use them by mistake.
You may notice that field "field 3" has lines on it, unlike the usual scrolling field. A transparent field with "Show Lines" checked will underline for you, but will also, unfortunately, prevent you from entering text into that field directly.
I have added an algorithm that aligns the top of the first line with the top of the field, so you won't stop the scroller with only part of the first line showing.
<Click> for more ...
*** INSTALLATION INSTRUCTIONS ***
You MUST:
• Put handlers "Open Card" and "ChangeScroll" into your card's script.
• Put "mouseWithin" handler in all fields you want to use to control the others.
• Change names of fields in card's script to the names of your fields.
P.S. I have made two other versions of this, if people show an interest:
> One of them tells you which line numbers are showing on screen, and how many total lines have been entered into the field; and
> The other works with buttons instead of scroll bars, moving up or down a line or a screen at a time.